/*
 * @Description: 
 * @Author: Yong
 * @Date: 2021-09-29 15:58:05
 * @LastEditTime: 2021-10-04 22:52:26
 */
import { Configuration, App } from "@midwayjs/decorator"
import { Application } from "@midwayjs/koa"
import * as bodyParser from "koa-bodyparser"
import * as orm from "@midwayjs/orm"
import { join } from 'path'
import * as cors from '@koa/cors'

@Configuration({
    conflictCheck: true,
    imports: [orm],
    importConfigs: [join(__dirname, "./config")],
})
export class ContainerLifeCycle {
    @App()
    app: Application

    async onReady() {
        this.app.use(bodyParser())
                .use(cors({ origin: '*', }))
        // 注册全局路由中间件 - token认证
        // this.app.use( await this.app.generateMiddleware('loginAuth'))
        
    }
}
